<?php
/**
 * Created by PhpStorm.
 * BuyUser: u
 * Date: 2018/11/8
 * Time: 14:00
 */

namespace common\logics\test;

use common\widgets\Request;
use common\widgets\Tool;
use yii\base\BaseObject;
use Yii;


class TestLogic extends BaseObject implements ITest
{
    /** @var \common\sources\read\test\TestAccess  $RTestAccess */
    private $RTestAccess;
    /** @var \common\sources\write\test\TestAccess $WTestAccess */
    private $WTestAccess;

    public function init(){
        $this->RTestAccess = Yii::$container->get('RTestAccess');
        $this->WTestAccess = Yii::$container->get('WTestAccess');
        parent::init();
    }

    public function getA($param, $b)
    {
        //先将phone 值为null 一下
//        $param['phone'] = '';
        if(empty($param['phone'])){
            return Tool::returnJson([],5001,'手机不能为空');
        }
        if(empty($param['pwd'])){
            return Tool::returnJson([],502,'密码不能为空');
        }
        // TODO: Implement getA() method.
        $test = $this->RTestAccess->getTestAll();
        return Tool::returnJson($test);
    }

}